<html>
<head><meta charset="utf-8"><title>checking generic arg != 0 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html">checking generic arg != 0</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="248388441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248388441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248388441">(Aug 04 2021 at 18:26)</a>:</h4>
<p>for <a href="#narrow/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F/near/248387965">https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F/near/248387965</a> i want to check that some const arguments are not equal to zero and concrete</p>



<a name="248388566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248388566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248388566">(Aug 04 2021 at 18:27)</a>:</h4>
<p>checking it for methods and functions is fairly easy and doable on the hir after typeck</p>



<a name="248388729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248388729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248388729">(Aug 04 2021 at 18:28)</a>:</h4>
<p>i don't think that i can easily do the same for types</p>



<a name="248388934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248388934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248388934">(Aug 04 2021 at 18:30)</a>:</h4>
<p>to do that I would probably add a new kind of predicate which just checks for <code>=! 0</code>, similar to <code>ConstEquate</code> predicates (or even reusing <code>ConstEquate</code> predicates) and then add these predicates in <code>wf</code> as part of the nominal obligations</p>



<a name="248389053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248389053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248389053">(Aug 04 2021 at 18:30)</a>:</h4>
<p>does anyone have a different idea for this, (ab)using the trait system for this seems kind of ugly</p>



<a name="248389071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248389071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248389071">(Aug 04 2021 at 18:31)</a>:</h4>
<p>also once again cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> on your input here</p>



<a name="248479985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/checking%20generic%20arg%20%21%3D%200/near/248479985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.html#248479985">(Aug 05 2021 at 13:54)</a>:</h4>
<p>had an idea, but that has big problems so I removed it from this topic: <a href="#narrow/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.20.28failed.20idea.29/near/248468052">https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200.20.28failed.20idea.29/near/248468052</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>